#负责整个项目的配置信息
class Config():
    import os

    #配置数据库和sqlalchemy
    HOSTNAME = ''
    PORT = '3306'
    DATABASE = 'mysql1'
    USERNAME = 'root'
    PASSWORD = '147258++'
    DB_URI = 'mysql+pymysql://{}:{}@{}:{}/{}?charset=utf8'.format(USERNAME, PASSWORD, HOSTNAME, PORT, DATABASE)

    SQLALCHEMY_DATABASE_URI = DB_URI
    SQLALCHEMY_TRACK_MODIFICATIONS = False
    # 日志的配置
    LOGGING_LEVEL = 'DEBUG'  # 配置等级
    LOGGING_FILE_DIR = 'log/'  # 配置目录
    LOGGING_FILE_MAX_BYTES = 300 * 1024 * 1024  # 日志大小
    LOGGING_FILE_BACKUP = 10  # 备份日志个数
    #限流器采用redis保存数据
    RATELIMIT_STORAGE_URL='redis://192.168.175.130:6379/0'
    RATELIMIT_STRATEGY='moving-window'


    #redis的链接地址
    REDIS_URL='redis://192.168.175.130:6379/1'
    #配置elasticsearch

    ELASTICSEARCH_URL = 'http: // 192.168.175.130: 9200'

    basedir = os.path.abspath(os.path.dirname(__file__))
    # 在默认配置中对索引存放位置
    WHOOSH_BASE = os.path.join(basedir, 'WHOOSH_BASE_INDEX')

#开发环境下的配置信息
class DevelopmentConfig(Config):
     DEBUG=True
     SQLALCHEMY_ECHO=True




#生产环境下的配置信息
class ProductConfig(Config):
      pass


#把两个不同环境下的配置和字符串映射起来
map_config={
    'develop':DevelopmentConfig,
    'product':ProductConfig


}


